const plugins = require("./webpack_plugin.js");

const rules={
	css:{
		test:/\.css$/,
		use:plugins.extractCss.extract({
			fallback:"style-loader",
			use:[{
				loader:"css-loader",
				options:{
					modules:true,
				},
			},
			"postcss-loader",
			]
		}),
	},
	scss:{
		test:/\.scss$/,
		use:plugins.extractCss.extract({
			fallback:"style-loader",
			use:[
					{
						loader:"css-loader",
					},
					{
						loader:"sass-loader",
					},
			]
		}),
	},
	js:{
		test:/\.(js|jsx)$/,
		use:[
			{
				loader:"babel-loader",
			}
		],
		exclude:/node_modules/,		
	},
	img:{
		test:/\.(png|gif|jpg)$/,
		use:[
			{
				loader:"url-loader",
				options:{
					limit:5000,
					outputPath:"images/", // 图片目录
					publicPath:"../"
				}
			},
		],
	},
}

module.exports=rules;